<template>
    <a-drawer width="640" placement="right" :closable="false" :visible="projectInfoVisible" @close="projectInfoVisible = false">
        <p :style="[pStyle, pStyle2]">
            项目详情
        </p>

        <a-descriptions bordered :title="projectInfo.name" :column="2">
            <a-descriptions-item label="项目号">
                {{projectInfo.no}}
            </a-descriptions-item>
            <a-descriptions-item label="项目名">
                {{projectInfo.name}}
            </a-descriptions-item>
            <a-descriptions-item label="所属省份">
                {{projectInfo.province}}
            </a-descriptions-item>
            <a-descriptions-item label="所属地市">
                {{projectInfo.city}}
            </a-descriptions-item>
            <a-descriptions-item label="地址">
                {{projectInfo.location}}
            </a-descriptions-item>
            <a-descriptions-item label="建设单位">
                {{projectInfo.buildCompany}}
            </a-descriptions-item>
            <a-descriptions-item label="建成时间">
                {{projectInfo.buildFinishTime}}
            </a-descriptions-item>
            <a-descriptions-item label="房屋报建性质">
                {{projectInfo.type}}
            </a-descriptions-item>
            <a-descriptions-item label="建筑结构">
                {{projectInfo.structure}}
            </a-descriptions-item>
            <a-descriptions-item label="楼层数量">
                {{projectInfo.floorNum}}
            </a-descriptions-item>
            <a-descriptions-item label="梯口数量">
                {{projectInfo.elevatorNum}}
            </a-descriptions-item>
            <a-descriptions-item label="住房总套数">
                {{projectInfo.roomNum}}
            </a-descriptions-item>
            <a-descriptions-item label="确认办证时间">
                {{projectInfo.confirmTime}}
            </a-descriptions-item>
            
        </a-descriptions>
        <a-divider />
    </a-drawer>
</template>

<script>
import {getAction} from '@/api/manage'

export default {
    name: "projectInfoDrawer",
    data () {
        return {
            projectInfoVisible: false,
            projectInfo:{},
            pStyle: {
            fontSize: '16px',
            color: 'rgba(0,0,0,0.85)',
            lineHeight: '24px',
            display: 'block',
            marginBottom: '16px',
            },
            pStyle2: {
            marginBottom: '24px',
            },

            url:{
                getProjectInfoById: "/projectroom/znzfProject/searchById",
                getProjectInfoByRadId: "/projectroom/znzfProject/searchByRadId",
            }
        }
    },

    computed: {},

    created() {},

    methods: {
        showProjectInfo(id){
            this.getProjectInfoById(id);
            this.projectInfoVisible = true;
        },
        getProjectInfoById(projectId){
            if (!this.url.getProjectInfoById) {
                this.$message.error('请设置url.getProjectInfoById属性!')
                return
            }

            if (projectId === '') return
            let params ={
                projectId: projectId,
            }
            getAction(this.url.getProjectInfoById, params).then((res) => {
                console.log(res);
                if (res.success) {
                    
                    this.projectInfo = res.result;
                }
                else{
                    this.$message.warning(res.message)
                }
            })
        },
        showProjectInfoByRadId(id){
            this.getProjectInfoByRadId(id);
        },
        getProjectInfoByRadId(radId){
            if (!this.url.getProjectInfoByRadId) {
                this.$message.error('请设置url.getProjectInfoByRadId属性!')
                return
            }

            if (radId === '') return
            let params ={
                radId: radId,
            }
            getAction(this.url.getProjectInfoByRadId, params).then((res) => {
                console.log(res);
                if (res.success) {
                    this.projectInfoVisible = true;
                    this.projectInfo = res.result;
                }
                else{
                    this.$message.warning(res.message)
                }
            })
        }
    }
}

</script>
<style scoped>
</style>